All datasets, summary values, study scenarios and experiment outcomes in this guide are synthetic illustrative teaching examples unless a real historical study is named, and none is a report of actual research for this course.本指南所有数据、汇总值、研究情境及实验结果均为合成教学示例(点名的真实历史研究除外),不是针对本课程的真实研究报告。
AP Statistics

Unit 9: Testing a Claim

Test a claim about one proportion or one mean: hypotheses, conditions, test statistics, p-values, conclusions in context, and Type I and Type II errors.

Topics 9.1 to 9.6Bilingual edition
AP 统计学

单元 9:显著性检验

检验关于一个比例或一个均值的说法:假设、适用条件、检验统计量、p 值、结合情境的结论,以及第一类与第二类错误。

主题 9.1 至 9.6中英双语版
Read me first

Each topic gives objectives, an explanation, worked examples, an exam tip, common mistakes and check questions with answers. Use the contents list to jump to a topic, then finish with the unit quiz. All data are synthetic illustrations.

阅读提示

每个主题含学习目标、讲解、例题、考试提示、常见错误与带答案的自测题。可用目录跳转到任一主题,最后完成单元自测。所有数据均为合成示例。

Setting Up a Test for a Population Proportion设置总体比例的检验

Learning objectives学习目标
  • State the null hypothesis $H_0$ and the alternative hypothesis $H_a$ for a claim about one population proportion, defining the parameter in words.
  • Decide whether the alternative is one-sided or two-sided from the wording of the question.
  • Explain the role of the significance level $\alpha$ and choose it before looking at the data.
  • Check the conditions for a test: random, 10% condition, and at least 10 expected successes and 10 expected failures using the hypothesized value $p_0$.
  • Explain why a test uses $p_0$ where an interval uses $\hat{p}$.
  • 针对一个总体比例的说法,写出原假设 $H_0$ 与备择假设 $H_a$,并用文字定义参数。
  • 根据题目措辞判断备择假设是单侧还是双侧。
  • 解释显著性水平 $\alpha$ 的作用,并在看数据之前确定它。
  • 检验条件:随机、10% 条件,以及用假设值 $p_0$ 算得的至少 10 个预期成功与 10 个预期失败。
  • 解释为什么检验用 $p_0$,而区间用 $\hat{p}$。

Hypotheses假设

A significance test weighs the evidence in a sample against a claim. The claim being tested is the null hypothesis $H_0$: it says the parameter equals a specific hypothesized value $p_0$, so it always contains an equals sign, as in $H_0: p=p_0$. The alternative hypothesis $H_a$ is what we suspect or want evidence for. It is one-sided if it points in one direction ($H_a: p>p_0$ or $H_a: p<p_0$) and two-sided if it says only that the value differs ($H_a: p\ne p_0$).

显著性检验用样本中的证据去衡量一个说法。被检验的说法是原假设 $H_0$:它断言参数等于某个具体的假设值 $p_0$,所以总含等号,如 $H_0: p=p_0$。备择假设 $H_a$ 是我们怀疑或想获得证据支持的内容。若它指向一个方向($H_a: p>p_0$ 或 $H_a: p<p_0$)则是单侧的;若只说取值不同($H_a: p\ne p_0$)则是双侧的。

The question asks whether$H_a$ isType
the proportion is greater than $p_0$ (increased, exceeds, more than)$p>p_0$one-sided (right-tailed)
the proportion is less than $p_0$ (decreased, fewer than, below)$p<p_0$one-sided (left-tailed)
the proportion is different from $p_0$ (changed, not equal to)$p\ne p_0$two-sided
题目问$H_a$ 为类型
比例大于 $p_0$(增加、超过、多于)$p>p_0$单侧(右尾)
比例小于 $p_0$(减少、少于、低于)$p<p_0$单侧(左尾)
比例不同于 $p_0$(改变、不等于)$p\ne p_0$双侧

Always define the parameter in words and in context: "$p$ = the proportion of all customers of this bakery who choose a gluten-free item." Hypotheses are about parameters, never about statistics, so $H_0: \hat{p}=0.25$ is wrong.

始终结合情境用文字定义参数:“$p$ = 这家面包店全体顾客中选择无麸质食品的比例。”假设讨论的是参数,绝不是统计量,所以写 $H_0: \hat{p}=0.25$ 是错的。

Significance level and conditions显著性水平与条件

The significance level $\alpha$ is the cut-off for how unlikely a result must be, if $H_0$ is true, before we call it convincing evidence against $H_0$. Common choices are $\alpha=0.05$ and $\alpha=0.01$; choose it before looking at the data. Its meaning as an error rate is the subject of topic 9.4.

显著性水平 $\alpha$ 是临界标准:若 $H_0$ 为真,结果必须多么罕见,才算对 $H_0$ 有令人信服的反对证据。常用 $\alpha=0.05$ 与 $\alpha=0.01$;要在看数据之前确定。它作为错误率的含义见主题 9.4。

The conditions mirror the interval but use the hypothesized value, because the test works in a world where $H_0$ is true: (1) random sample or randomized experiment; (2) 10% condition; (3) the expected number of successes and failures under $H_0$ is at least 10, that is, $np_0\ge 10$ and $n(1-p_0)\ge 10$. These checks use $p_0$, not $\hat{p}$.

条件与区间对应,但使用假设值,因为检验是在 $H_0$ 为真的世界里进行的:(1) 随机样本或随机化实验;(2) 10% 条件;(3) 在 $H_0$ 下预期的成功数与失败数至少为 10,即 $np_0\ge 10$ 且 $n(1-p_0)\ge 10$。这些检验用 $p_0$,不用 $\hat{p}$。

Worked Example: writing hypotheses from a claim例题:依据说法写出假设

Write $H_0$ and $H_a$ for each claim, defining the parameter. (a) A bakery states that 25% of customers choose a gluten-free item; the owner suspects the true share is lower. (b) A player's long-run free-throw rate is $70\%$; after a training program her coach believes it has improved. (c) A district reports that 48% of voters approve of a plan; a reporter thinks the figure is wrong. (Illustrative claims.)

  1. (a) $p$ = the proportion of all customers of this bakery who choose a gluten-free item. $H_0: p=0.25$, $H_a: p<0.25$ (one-sided; the owner suspects lower).
  2. (b) $p$ = the proportion of free throws this player makes after the training program. $H_0: p=0.70$, $H_a: p>0.70$ (one-sided; improvement).
  3. (c) $p$ = the proportion of all voters in the district who approve of the plan. $H_0: p=0.48$, $H_a: p\ne 0.48$ (two-sided; "wrong" does not say which way).

Why this works: the direction of $H_a$ comes from the question asked before the data are seen, and $H_0$ always names the single value being tested.

针对每个说法写出 $H_0$ 与 $H_a$ 并定义参数。(a) 某面包店称 25% 的顾客选择无麸质食品,店主怀疑真实占比更低。(b) 某球员长期罚球命中率为 $70\%$;训练后教练认为有所提高。(c) 某学区报告 48% 的选民赞成一项计划,记者认为这个数字不对。(示意说法。)

  1. (a) $p$ = 这家面包店全体顾客中选择无麸质食品的比例。$H_0: p=0.25$,$H_a: p<0.25$(单侧;店主怀疑更低)。
  2. (b) $p$ = 该球员训练后罚球的命中比例。$H_0: p=0.70$,$H_a: p>0.70$(单侧;提高)。
  3. (c) $p$ = 该学区全体选民中赞成这项计划的比例。$H_0: p=0.48$,$H_a: p\ne 0.48$(双侧;“不对”没有说明方向)。

原理:$H_a$ 的方向取决于看数据之前提出的问题,而 $H_0$ 总是指明被检验的那个具体值。

Worked Example: conditions use the hypothesized value例题:条件使用假设值

An inspector tests $H_0: p=0.15$ against $H_a: p\ne 0.15$ for the proportion of defective parts from a very large production run, using a random sample of $n=100$ parts in which 9 are defective. Check the conditions. (Illustrative data.)

  1. Random. The parts were randomly sampled (stated).
  2. 10% condition. The run is very large, so $100$ is less than 10% of it.
  3. Expected counts under $H_0$. $np_0=100(0.15)=15\ge 10$ and $n(1-p_0)=100(0.85)=85\ge 10$. Both hold, so the sampling distribution of $\hat{p}$ is approximately normal when $H_0$ is true.
  4. Note. The sample has only $9$ defective parts, but that is irrelevant for a test: the question is what the distribution looks like if $p=0.15$. (For an interval, the sample counts $n\hat{p}=9<10$ would be a problem.)

检查员对一大批产品中次品比例检验 $H_0: p=0.15$ 对 $H_a: p\ne 0.15$,随机抽取 $n=100$ 件,其中 9 件为次品。检验条件。(示意数据。)

  1. 随机。零件为随机抽取(已说明)。
  2. 10% 条件。这批产品数量很大,所以 $100$ 不到其 10%。
  3. $H_0$ 下的预期计数。$np_0=100(0.15)=15\ge 10$,$n(1-p_0)=100(0.85)=85\ge 10$。二者都成立,所以 $H_0$ 为真时 $\hat{p}$ 的抽样分布近似正态。
  4. 注意。样本中只有 $9$ 件次品,但这对检验无关紧要:问题是如果 $p=0.15$,分布是什么样。(对区间而言,样本计数 $n\hat{p}=9<10$ 就会是问题。)
Worked Example: a complete setup in context例题:情境中的完整设置

A subscription company says that 60% of its users renew after the first year. A product manager suspects the renewal rate is lower. In a random sample of 150 users (a small part of a much larger user base), 81 renewed. Write the full setup: hypotheses, procedure, conditions and test statistic. (Illustrative data.)

  1. Hypotheses. Let $p$ = the proportion of all this company's users who renew after the first year. $H_0: p=0.60$ and $H_a: p<0.60$ ("lower" makes the alternative one-sided). No level is given, so use $\alpha=0.05$.
  2. Procedure and conditions. One-sample $z$ test for a proportion. Random: stated. 10% condition: 150 is less than 10% of the users. Expected counts under $H_0$: $np_0=150(0.60)=90\ge 10$ and $n(1-p_0)=150(0.40)=60\ge 10$.
  3. Statistic. $\hat{p}=81/150=0.54$. The standard error uses $p_0$: $\sqrt{0.60(0.40)/150}=\sqrt{0.0016}=0.04$. So $z=\dfrac{0.54-0.60}{0.04}=-1.50$.
  4. Look ahead. The lower-tail area is $P(Z<-1.50)\approx 0.067$, which is greater than $0.05$. A complete answer states that the data do not provide convincing evidence that the proportion of all users who renew is less than 0.60.

Why this works: the claim fixes $H_0$ and $p_0$, the manager's question fixes the direction of $H_a$, and the sample enters only through $\hat{p}$ in the numerator of $z$.

一家订阅公司称其 60% 的用户在第一年后续订。产品经理怀疑续订率更低。在一个随机样本的 150 名用户(只占庞大用户群的一小部分)中,81 人续订。写出完整的检验设置:假设、方法、条件与检验统计量。(示意数据。)

  1. 假设。设 $p$ = 该公司全体用户中第一年后续订的比例。$H_0: p=0.60$,$H_a: p<0.60$(“更低”使备择假设为单侧)。题目未给水平,取 $\alpha=0.05$。
  2. 方法与条件。总体比例的单样本 $z$ 检验。随机:已说明。10% 条件:150 不到用户总数的 10%。$H_0$ 下的预期计数:$np_0=150(0.60)=90\ge 10$,$n(1-p_0)=150(0.40)=60\ge 10$。
  3. 统计量。$\hat{p}=81/150=0.54$。标准误使用 $p_0$:$\sqrt{0.60(0.40)/150}=\sqrt{0.0016}=0.04$。所以 $z=\dfrac{0.54-0.60}{0.04}=-1.50$。
  4. 预先看结果。下尾面积 $P(Z<-1.50)\approx 0.067$,大于 $0.05$。完整的答案应写出:数据没有提供令人信服的证据表明全体用户的续订比例低于 0.60。

原理:说法确定了 $H_0$ 与 $p_0$,经理的问题确定了 $H_a$ 的方向,样本只通过 $z$ 分子中的 $\hat{p}$ 进入计算。

Common Mistake: hypotheses about the sample

Writing $H_0: \hat{p}=0.25$, or "$H_0$: the sample has 25%," is a frequent error. The sample proportion is known; the hypotheses are statements about the unknown population proportion $p$. Also avoid inequalities in $H_0$ and do not switch the direction of $H_a$ after seeing which way the data point.

常见错误:关于样本的假设

写 $H_0: \hat{p}=0.25$ 或“$H_0$:样本中有 25%”是常见错误。样本比例是已知的;假设是关于未知总体比例 $p$ 的陈述。另外,$H_0$ 中不要用不等式,也不要在看到数据偏向后再改变 $H_a$ 的方向。

Exam tip考试提示

Write the parameter definition with the population and variable, then $H_0$ with $p_0$ and $H_a$ with the correct symbol. In the Plan step, give the name of the test (one-proportion $z$-test), the hypotheses, the significance level, and the three conditions with the numbers $np_0$ and $n(1-p_0)$.

先写出带总体和变量的参数定义,再写带 $p_0$ 的 $H_0$ 和符号正确的 $H_a$。在 Plan 一步中,给出检验名称(单比例 $z$ 检验)、假设、显著性水平,以及带 $np_0$ 与 $n(1-p_0)$ 数值的三个条件。

Check your understanding自我检测
A company says 80% of its deliveries arrive within a day. A customer group believes the true proportion is lower. Write $H_0$ and $H_a$ with the parameter defined.某公司称其 80% 的投递在一天内送达。客户团体认为真实比例更低。写出 $H_0$ 与 $H_a$ 并定义参数。

$p$ = the proportion of all this company's deliveries that arrive within a day. $H_0: p=0.80$, $H_a: p<0.80$.

$p$ = 该公司全部投递中一天内送达的比例。$H_0: p=0.80$,$H_a: p<0.80$。

Why is $H_0: \hat{p}=0.80$ not acceptable?为什么 $H_0: \hat{p}=0.80$ 不可接受?

Hypotheses are about a population parameter. $\hat{p}$ is a statistic from the sample, so it is known and cannot be hypothesized about.

假设针对总体参数。$\hat{p}$ 是来自样本的统计量,是已知的,不能对它做假设。

For $H_0: p=0.10$ with a random sample of $n=60$, check whether the expected counts condition holds.对 $H_0: p=0.10$、随机样本 $n=60$,检验预期计数条件是否成立。

$np_0=60(0.10)=6<10$, so the condition fails and the normal model for $\hat{p}$ is not appropriate (even though $n(1-p_0)=54\ge 10$).

$np_0=60(0.10)=6<10$,条件不成立,$\hat{p}$ 不宜用正态模型(尽管 $n(1-p_0)=54\ge 10$)。

Interpreting a p-Value解释 p 值

Learning objectives学习目标
  • Define the p-value as the probability, assuming the null hypothesis is true, of a result at least as extreme as the observed one.
  • Find a p-value as a tail area for a right-tailed, left-tailed or two-sided alternative.
  • Interpret a p-value in context, naming the population, the null value and the direction of "extreme".
  • Compare a p-value with $\alpha$ to describe how strong the evidence against $H_0$ is.
  • Explain why the p-value is not the probability that $H_0$ is true.
  • 把 p 值定义为:假定原假设为真时,得到至少与观察结果一样极端的结果的概率。
  • 对右尾、左尾或双侧备择假设,把 p 值求为尾部面积。
  • 结合情境解释 p 值,点明总体、原假设取值以及“极端”的方向。
  • 把 p 值与 $\alpha$ 比较,说明反对 $H_0$ 的证据有多强。
  • 解释为什么 p 值不是 $H_0$ 为真的概率。

The p-value is the probability of getting a sample result at least as extreme as the one observed (in the direction of $H_a$), assuming the null hypothesis is true. It measures how surprising the data are in a world where $H_0$ holds. A small p-value means the observed result would be rare if $H_0$ were true, which is evidence against $H_0$; a large p-value means the result is ordinary under $H_0$.

p 值是在假定原假设为真的前提下,得到至少与所观察样本结果一样极端(沿 $H_a$ 的方向)的结果的概率。它衡量在 $H_0$ 成立的世界里数据有多令人意外。p 值小,说明若 $H_0$ 为真则该结果罕见,这是反对 $H_0$ 的证据;p 值大,说明该结果在 $H_0$ 下很平常。

To find it, standardize to the test statistic $z$ (topic 9.3) and take the area under the standard normal curve in the direction of $H_a$: the right tail for $H_a: p>p_0$, the left tail for $H_a: p<p_0$, and both tails (double the one-tail area) for $H_a: p\ne p_0$.

求 p 值时,先标准化为检验统计量 $z$(主题 9.3),再沿 $H_a$ 的方向取标准正态曲线下的面积:$H_a: p>p_0$ 取右尾,$H_a: p<p_0$ 取左尾,$H_a: p\ne p_0$ 取两侧尾部(单尾面积的两倍)。

-3-3 -2-2 -1-1 00 11 22 33 observed z ≈ -2.15观察到 z ≈ -2.15 p-value ≈ 0.016p 值 ≈ 0.016 If H0 is true, z follows this curve若 H0 为真,z 服从这条曲线 test statistic z检验统计量 z
Figure 6.4. The p-value as an area. For the left-tailed test of H0: p = 0.12 against Ha: p < 0.12, the observed z of about -2.15 cuts off a left tail of area about 0.016: the chance of a result this low or lower if H0 is true.图 6.4。p 值是一块面积。对 H0:p = 0.12 对 Ha:p < 0.12 的左尾检验,观察到的 z 约为 -2.15,截出面积约 0.016 的左尾:即 H0 为真时结果这样低或更低的概率。
The p-value is not the probability that H0 is true

The p-value is not the probability that the null hypothesis is true, and it is not the probability that the result happened "by chance." It is a probability about the data computed assuming $H_0$. A p-value of $0.03$ does not mean $H_0$ has a 3% chance of being true. Under the usual set-up $H_0$ is either true or false and has no probability in this framework.

p 值不是 H0 为真的概率

p 值不是原假设为真的概率,也不是结果“出于偶然”的概率。它是在假定 $H_0$ 成立下计算的、关于数据的概率。p 值为 $0.03$ 并不表示 $H_0$ 有 3% 的可能为真。在通常的框架里,$H_0$ 要么为真要么为假,没有概率可言。

Worked Example: finding p-values from z例题:由 z 求 p 值

Find the p-value for (a) $H_a: p>p_0$ with $z=1.84$, and (b) $H_a: p\ne p_0$ with $z=-2.30$.

  1. (a) Right-tailed. p-value $=P(Z\ge 1.84)\approx 0.0329$ (normalcdf(1.84,1E99)).
  2. (b) Two-sided. One tail is $P(Z\le -2.30)\approx 0.0107$; double it for both tails: p-value $\approx 0.0214$ (2*normalcdf(-1E99,-2.30)).
  3. Sense check. The farther $z$ is from 0 in the direction of $H_a$, the smaller the p-value. A two-sided test has twice the area of a one-sided test for the same $|z|$.

求 (a) $H_a: p>p_0$、$z=1.84$ 与 (b) $H_a: p\ne p_0$、$z=-2.30$ 时的 p 值。

  1. (a) 右尾。p 值 $=P(Z\ge 1.84)\approx 0.0329$(normalcdf(1.84,1E99))。
  2. (b) 双侧。一侧为 $P(Z\le -2.30)\approx 0.0107$;两侧取两倍:p 值 $\approx 0.0214$(2*normalcdf(-1E99,-2.30))。
  3. 合理性检查。$z$ 沿 $H_a$ 方向离 0 越远,p 值越小。对相同的 $|z|$,双侧检验的面积是单侧的两倍。
Worked Example: interpreting a p-value in context例题:结合情境解释 p 值

A pharmacy's old process had a 12% error rate. After retraining, a random sample of 400 prescriptions has 34 errors ($\hat{p}=0.085$). A test of $H_0: p=0.12$ against $H_a: p<0.12$ gives $z\approx -2.15$ and a p-value of about $0.016$. Interpret the p-value. (Illustrative data.)

  1. Direction of "extreme". $H_a$ is left-tailed, so results at least as extreme are sample proportions of $0.085$ or smaller.
  2. Interpretation. Assuming the true error rate is still $0.12$, there is about a $1.6\%$ chance of getting a sample proportion of $0.085$ or less in a random sample of 400 prescriptions.
  3. Meaning. That is rare, so the data provide evidence against $H_0$ (we will make the formal decision in topic 9.3).
  4. Not this. It is wrong to say "there is a $1.6\%$ chance the error rate is still $0.12$."

某药房旧流程的错误率为 12%。再培训后,随机抽取 400 张处方,有 34 张出错($\hat{p}=0.085$)。检验 $H_0: p=0.12$ 对 $H_a: p<0.12$,得 $z\approx -2.15$,p 值约 $0.016$。解释该 p 值。(示意数据。)

  1. “极端”的方向。$H_a$ 为左尾,所以至少同样极端的结果是样本比例 $0.085$ 或更小。
  2. 解释。假定真实错误率仍是 $0.12$,在 400 张处方的随机样本中,样本比例达到 $0.085$ 或更低的概率约为 $1.6\%$。
  3. 含义。这很罕见,所以数据提供了反对 $H_0$ 的证据(正式决定见主题 9.3)。
  4. 不要这样说。说“错误率仍为 $0.12$ 的概率是 $1.6\%$”是错的。
Worked Example: one p-value, two alternatives例题:同一数据,两种备择假设

Historically 40% of adults in a panel say they stream video daily. In a random sample of 200 adults (under 10% of the panel), 94 say they stream daily, so $\hat{p}=0.47$. Find the p-value if the researcher expected an increase ($H_a: p>0.40$) and if she had no direction in mind ($H_a: p\ne 0.40$), then compare both at $\alpha=0.03$. (Illustrative data.)

  1. Statistic. $SE=\sqrt{0.40(0.60)/200}=\sqrt{0.0012}\approx 0.0346$, so $z=\dfrac{0.47-0.40}{0.0346}\approx 2.02$.
  2. One-sided. $p\text{-value}=P(Z>2.02)\approx 0.022$.
  3. Two-sided. Both tails count: $2(0.0217)\approx 0.043$.
  4. Compare with $\alpha=0.03$. $0.022\le 0.03$, so the one-sided test rejects $H_0$. $0.043>0.03$, so the two-sided test fails to reject.

Why this matters: the two p-values differ by a factor of 2, so the choice of $H_a$ can change the decision. That is why the direction must come from the question before any data are seen, and why a researcher may not switch to the one-sided version after the two-sided test fails.

某个调查小组中历来有 40% 的成年人称每天观看流媒体视频。随机抽取 200 名成年人(不到小组人数的 10%),其中 94 人称每天观看,所以 $\hat{p}=0.47$。若研究者预期比例上升($H_a: p>0.40$),以及她没有预设方向($H_a: p\ne 0.40$),分别求 p 值,再在 $\alpha=0.03$ 下比较。(示意数据。)

  1. 统计量。$SE=\sqrt{0.40(0.60)/200}=\sqrt{0.0012}\approx 0.0346$,所以 $z=\dfrac{0.47-0.40}{0.0346}\approx 2.02$。
  2. 单侧。$p\text{-value}=P(Z>2.02)\approx 0.022$。
  3. 双侧。两侧尾部都要计入:$2(0.0217)\approx 0.043$。
  4. 与 $\alpha=0.03$ 比较。$0.022\le 0.03$,所以单侧检验拒绝 $H_0$。$0.043>0.03$,所以双侧检验不拒绝。

意义:两个 p 值相差一倍,所以 $H_a$ 的选择可能改变决定。因此方向必须在看数据之前由问题决定,研究者也不能在双侧检验不成功后改用单侧版本。

Common Mistake: reporting the p-value as the chance the null is true

Misconception: "p-value $=0.016$, so there is a 1.6% chance $H_0$ is true." Correct reading: if $H_0$ were true, results this extreme would occur about 1.6% of the time. Another common mistake is a p-value interpretation that leaves out "assuming $H_0$" or the direction of the tail.

常见错误:把 p 值说成原假设为真的概率

误区:“p 值 $=0.016$,所以 $H_0$ 为真的可能性是 1.6%。”正确读法:若 $H_0$ 为真,这样极端的结果约有 1.6% 的时间会出现。另一个常见错误是解释 p 值时漏掉“假定 $H_0$”或尾部方向。

Exam tip考试提示

A full p-value interpretation has four pieces: the assumption ("if the true proportion of ... is $p_0$"), the sample statistic and its direction ("a sample proportion of ... or less/more"), the sample size and context, and the probability. Leave out the assumption and the interpretation is incomplete.

完整的 p 值解释有四个部分:假设前提(“若……的真实比例为 $p_0$”)、样本统计量及其方向(“样本比例为……或更低/更高”)、样本容量与情境,以及概率。漏掉前提,解释就不完整。

Check your understanding自我检测
A test of $H_0: p=0.5$ against $H_a: p>0.5$ gives a p-value of $0.04$. Interpret it in a sentence that starts "Assuming the null hypothesis is true."检验 $H_0: p=0.5$ 对 $H_a: p>0.5$ 得 p 值 $0.04$。用以“假定原假设为真”开头的句子解释它。

Assuming the null hypothesis is true ($p=0.5$), there is a $0.04$ probability of getting a sample proportion at least as large as the one observed, in a random sample of the same size.

假定原假设为真($p=0.5$),在同样大小的随机样本中,得到至少与所观察值一样大的样本比例的概率为 $0.04$。

Find the p-value for a two-sided test with $z=-1.96$.求双侧检验中 $z=-1.96$ 时的 p 值。

One tail is about $0.025$, so the p-value is about $0.0500$ (twice the tail).

一侧约 $0.025$,所以 p 值约 $0.0500$(两倍尾部面积)。

Which p-value gives stronger evidence against $H_0$, $0.003$ or $0.20$? Why?$0.003$ 与 $0.20$ 哪个 p 值给出更强的反对 $H_0$ 的证据?为什么?

$0.003$. A result that rare under $H_0$ is much harder to explain by chance variation alone than one that happens 20% of the time.

$0.003$。在 $H_0$ 下如此罕见的结果,比发生概率为 20% 的结果更难单靠随机波动来解释。

Concluding a Test for a Population Proportion得出总体比例检验的结论

Learning objectives学习目标
  • Calculate the one-proportion $z$ test statistic using $p_0$ in the standard error.
  • Find the p-value for the correct tail(s) and compare it with $\alpha$.
  • State the decision (reject or fail to reject $H_0$) and a conclusion in context linked to the p-value.
  • Explain why we never accept $H_0$.
  • Carry out a complete four-step test and verify the answer with 1-PropZTest.
  • 计算单比例 $z$ 检验统计量,标准误中使用 $p_0$。
  • 求出对应尾部的 p 值并与 $\alpha$ 比较。
  • 写出决定(拒绝或不拒绝 $H_0$),以及与 p 值相联系的、结合情境的结论。
  • 解释为什么我们从不“接受” $H_0$。
  • 完成完整的四步检验,并用 1-PropZTest 核对答案。

The test statistic measures how many standard deviations the sample proportion is from the hypothesized value. For a one-proportion $z$-test (1-PropZTest):

检验统计量衡量样本比例离假设值有多少个标准差。对单比例 $z$ 检验(1-PropZTest):

$$z=\dfrac{\hat{p}-p_0}{\sqrt{\dfrac{p_0(1-p_0)}{n}}}$$

Note that the denominator uses $p_0$, not $\hat{p}$, because the test assumes $H_0$ is true. Find the p-value in the direction of $H_a$, then decide: if the p-value is less than or equal to $\alpha$, reject $H_0$; if it is greater than $\alpha$, fail to reject $H_0$.

注意分母用 $p_0$ 而不是 $\hat{p}$,因为检验假定 $H_0$ 为真。沿 $H_a$ 的方向求 p 值,然后决定:若 p 值小于或等于 $\alpha$,拒绝 $H_0$;若 p 值大于 $\alpha$,则不拒绝 $H_0$。

Write the conclusion in context and tie it to the p-value. If you reject: "Because the p-value of ... is less than $\alpha=0.05$, we reject $H_0$. There is convincing evidence that the true proportion of ... is greater than (less than, different from) $p_0$." If you fail to reject: "Because the p-value of ... is greater than $\alpha=0.05$, we fail to reject $H_0$. There is not convincing evidence that ...". We never accept $H_0$: failing to reject says only that the data do not rule out $p_0$, which is not the same as showing it is true. A large p-value does not prove $H_0$.

结论要结合情境并与 p 值挂钩。若拒绝:“因为 p 值 ... 小于 $\alpha=0.05$,我们拒绝 $H_0$。有令人信服的证据表明……的真实比例大于(小于、不同于)$p_0$。”若不拒绝:“因为 p 值 ... 大于 $\alpha=0.05$,我们不拒绝 $H_0$。没有令人信服的证据表明……”。我们从不接受 $H_0$:不拒绝只是说数据没有排除 $p_0$,并不等于证明它为真。较大的 p 值并不证明 $H_0$。

-3-3 -2-2 -1-1 00 11 22 33 observed z ≈ -1.22观察到 z ≈ -1.22 -1.96-1.96 1.961.96 p-value ≈ 0.22p 值 ≈ 0.22 (both tails)(两侧尾部) test statistic z检验统计量 z
Figure 6.5. A two-sided test at significance level 0.05. The green tails beyond ±1.96 are the rejection region (total area 0.05). The observed z of about -1.22 gives a p-value of about 0.22 (red, both tails), larger than 0.05, so we fail to reject H0.图 6.5。显著性水平 0.05 的双侧检验。±1.96 之外的绿色尾部是拒绝域(总面积 0.05)。观察到的 z 约为 -1.22,p 值约 0.22(红色,两侧尾部),大于 0.05,所以不能拒绝 H0。
Worked Example: a left-tailed test, reject H0例题:左尾检验,拒绝 H0

A hospital's historical 30-day readmission rate is $18\%$. After a new discharge program, a random sample of 350 patients (a small fraction of the hospital's patients) has 49 readmitted. Is there convincing evidence that the program lowered the readmission rate? Use $\alpha=0.05$. (Illustrative data.)

  1. State. $p$ = the true proportion of patients under the new program who are readmitted within 30 days. $H_0: p=0.18$, $H_a: p<0.18$, $\alpha=0.05$.
  2. Plan. One-proportion $z$-test. Random: stated. 10%: $350$ is less than 10% of the hospital's patients. Expected counts: $np_0=350(0.18)=63\ge 10$ and $n(1-p_0)=350(0.82)=287\ge 10$.
  3. Do. $\hat{p}=49/350=0.14$. $z=\dfrac{0.14-0.18}{\sqrt{\dfrac{0.18(0.82)}{350}}}=\dfrac{-0.04}{0.0205}\approx -1.95$. p-value $=P(Z\le -1.95)\approx 0.0256$, using $z$ rounded to two decimals. (1-PropZTest with $p_0=0.18$, $x=49$, $n=350$, $<p_0$ uses the unrounded $z$ and gives $0.0257$.)
  4. Conclude. Because the p-value of about $0.026$ is less than $\alpha=0.05$, we reject $H_0$. There is convincing evidence that the true proportion of patients readmitted within 30 days under the new program is less than $0.18$.

某医院历史上的 30 天再入院率为 $18\%$。实行新的出院方案后,随机抽取 350 名患者(只占该院患者的一小部分),其中 49 人再入院。是否有令人信服的证据表明该方案降低了再入院率?取 $\alpha=0.05$。(示意数据。)

  1. State。$p$ = 新方案下患者在 30 天内再入院的真实比例。$H_0: p=0.18$,$H_a: p<0.18$,$\alpha=0.05$。
  2. Plan。单比例 $z$ 检验。随机:已说明。10%:$350$ 不到该院患者的 10%。预期计数:$np_0=350(0.18)=63\ge 10$,$n(1-p_0)=350(0.82)=287\ge 10$。
  3. Do。$\hat{p}=49/350=0.14$。$z=\dfrac{0.14-0.18}{\sqrt{\dfrac{0.18(0.82)}{350}}}=\dfrac{-0.04}{0.0205}\approx -1.95$。p 值 $=P(Z\le -1.95)\approx 0.0256$,这里用的是保留两位小数的 $z$。(1-PropZTest:$p_0=0.18$,$x=49$,$n=350$,$<p_0$,使用未取整的 $z$,结果为 $0.0257$。)
  4. Conclude。因为 p 值约 $0.026$ 小于 $\alpha=0.05$,我们拒绝 $H_0$。有令人信服的证据表明,新方案下患者 30 天内再入院的真实比例小于 $0.18$。
Worked Example: a two-sided test, fail to reject H0例题:双侧检验,不拒绝 H0

A cereal maker states that 20% of its boxes contain a prize. A consumer buys a random sample of 150 boxes (a small fraction of all boxes) and finds 24 prizes. Test whether the true proportion differs from $0.20$ at $\alpha=0.05$. (Illustrative data.)

  1. State. $p$ = the true proportion of all boxes from this maker that contain a prize. $H_0: p=0.20$, $H_a: p\ne 0.20$, $\alpha=0.05$.
  2. Plan. One-proportion $z$-test. Random: stated; 10%: holds; $np_0=150(0.20)=30\ge 10$ and $n(1-p_0)=150(0.80)=120\ge 10$.
  3. Do. $\hat{p}=24/150=0.16$. $z=\dfrac{0.16-0.20}{\sqrt{\dfrac{0.20(0.80)}{150}}}=\dfrac{-0.04}{0.0327}\approx -1.22$. The alternative is two-sided, so p-value $=2\,P(Z\le -1.22)\approx 0.2225$ with $z$ rounded to two decimals (the calculator uses the unrounded $z=-1.2247$ and gives $0.2207$).
  4. Conclude. Because the p-value of about $0.22$ is greater than $\alpha=0.05$, we fail to reject $H_0$. There is not convincing evidence that the true proportion of this maker's boxes containing a prize differs from $0.20$. This does not prove that the true proportion is $0.20$.

某谷物制造商称其 20% 的盒子里有奖品。一位消费者随机买了 150 盒(只占全部盒子的一小部分),发现 24 个奖品。在 $\alpha=0.05$ 下检验真实比例是否不同于 $0.20$。(示意数据。)

  1. State。$p$ = 该制造商全部盒子中含奖品的真实比例。$H_0: p=0.20$,$H_a: p\ne 0.20$,$\alpha=0.05$。
  2. Plan。单比例 $z$ 检验。随机:已说明;10%:成立;$np_0=150(0.20)=30\ge 10$,$n(1-p_0)=150(0.80)=120\ge 10$。
  3. Do。$\hat{p}=24/150=0.16$。$z=\dfrac{0.16-0.20}{\sqrt{\dfrac{0.20(0.80)}{150}}}=\dfrac{-0.04}{0.0327}\approx -1.22$。备择假设为双侧,所以 p 值 $=2\,P(Z\le -1.22)\approx 0.2225$,这里用的是保留两位小数的 $z$(计算器使用未取整的 $z=-1.2247$,结果为 $0.2207$)。
  4. Conclude。因为 p 值约 $0.22$ 大于 $\alpha=0.05$,我们不拒绝 $H_0$。没有令人信服的证据表明,该制造商含奖品的盒子的真实比例不同于 $0.20$。这并不证明真实比例就是 $0.20$。
Calculator: TI-84

Press STAT, use the right arrow to reach TESTS, and choose 5:1-PropZTest. Enter p0, the count x (whole number), n, and select prop as ≠p0, <p0 or >p0 to match $H_a$. Calculate gives $z$, the p-value, $\hat{p}$ and $n$. The calculator already doubles the tail for the two-sided choice. Write the hypotheses, conditions and conclusion yourself.

计算器:TI-84

按 STAT,用右方向键移到 TESTS,选择 5:1-PropZTest。输入 p0、计数 x(整数)、n,并按 $H_a$ 把 prop 选为 ≠p0、<p0 或 >p0。Calculate 给出 $z$、p 值、$\hat{p}$ 与 $n$。选双侧时,计算器已经把尾部面积加倍。假设、条件与结论仍要自己写。

Worked Example: a right-tailed test, full four steps例题:右尾检验的完整四步

A supplier states that at most 8% of its bolts are defective. A buyer suspects the rate is higher and checks a random sample of 250 bolts (less than 10% of the shipment), finding 28 defective. Carry out the test at $\alpha=0.05$ and write the conclusion. (Illustrative data.)

  1. State. Let $p$ = the proportion of all bolts from this supplier that are defective. $H_0: p=0.08$, $H_a: p>0.08$, $\alpha=0.05$.
  2. Plan. One-sample $z$ test for a proportion. Random and 10% conditions are given. $np_0=250(0.08)=20\ge 10$ and $n(1-p_0)=250(0.92)=230\ge 10$.
  3. Do. $\hat{p}=28/250=0.112$. $SE=\sqrt{0.08(0.92)/250}\approx 0.01716$. $z=\dfrac{0.112-0.08}{0.01716}\approx 1.87$. The upper-tail p-value is about $0.031$.
  4. Conclude. Because $0.031\le 0.05$, reject $H_0$. A complete answer states that the data provide convincing evidence that the proportion of all this supplier's bolts that are defective is greater than 0.08.

Why this works: the p-value is small enough that a sample like this would be unusual if the true rate were $8\%$. The test says only that the rate exceeds 0.08, not by how much; an interval would be needed to estimate the size.

某供应商声称其螺栓次品率至多为 8%。买方怀疑次品率更高,随机抽查 250 个螺栓(不到整批货的 10%),发现 28 个次品。在 $\alpha=0.05$ 下进行检验并写出结论。(示意数据。)

  1. 陈述。设 $p$ = 该供应商全部螺栓中次品的比例。$H_0: p=0.08$,$H_a: p>0.08$,$\alpha=0.05$。
  2. 计划。总体比例的单样本 $z$ 检验。随机与 10% 条件已给出。$np_0=250(0.08)=20\ge 10$,$n(1-p_0)=250(0.92)=230\ge 10$。
  3. 计算。$\hat{p}=28/250=0.112$。$SE=\sqrt{0.08(0.92)/250}\approx 0.01716$。$z=\dfrac{0.112-0.08}{0.01716}\approx 1.87$。上尾 p 值约为 $0.031$。
  4. 结论。因为 $0.031\le 0.05$,拒绝 $H_0$。完整的答案应写出:数据提供了令人信服的证据表明该供应商全部螺栓中次品的比例大于 0.08。

原理:p 值足够小,说明若真实次品率为 $8\%$,这样的样本会很少见。检验只说明比例超过 0.08,没有说明超出多少;要估计大小还需要区间。

When the p-value is close to $\alpha$p 值接近 $\alpha$ 时

The cutoff $\alpha$ is a rule fixed in advance, so a p-value of $0.049$ leads to rejecting $H_0$ and a p-value of $0.051$ to failing to reject it at $\alpha=0.05$, even though the two results are almost identical as evidence. Do not change $\alpha$ after seeing the p-value to get the conclusion you wanted. Instead, make the decision the rule gives and describe the strength honestly: report the p-value itself, and for a borderline result say that the evidence is weak or moderate rather than overwhelming. Also remember that the p-value measures only how surprising the data are under $H_0$; it does not measure the size or importance of the difference.

临界值 $\alpha$ 是事先定好的规则,所以在 $\alpha=0.05$ 下,p 值为 $0.049$ 时拒绝 $H_0$,p 值为 $0.051$ 时不拒绝,尽管作为证据二者几乎相同。不要在看到 p 值之后改动 $\alpha$ 以得到想要的结论。正确做法是按规则作出决定,并如实描述证据强度:写出 p 值本身,对临界情形说明证据较弱或中等,而不是压倒性的。还要记住,p 值只衡量在 $H_0$ 下数据有多令人意外,并不衡量差异的大小或重要性。

Common Mistake: accepting the null hypothesis

"We accept $H_0$" and "the null hypothesis is true" are wrong. A large p-value only means the data are consistent with $H_0$. Write "fail to reject $H_0$" and "there is not convincing evidence that ...". Also, make the conclusion about the parameter in context, not about the sample.

常见错误:“接受”原假设

“我们接受 $H_0$”和“原假设为真”都是错的。较大的 p 值只说明数据与 $H_0$ 相符。应写“不拒绝 $H_0$”和“没有令人信服的证据表明……”。另外,结论要针对情境中的参数,而不是针对样本。

Exam tip考试提示

Your conclusion must contain three things: the decision linked to the p-value and $\alpha$ ("because $0.026<0.05$, we reject $H_0$"), the words "convincing evidence" (or "not convincing evidence"), and the parameter in context with its direction. Writing only "reject $H_0$" is incomplete.

结论必须包含三点:与 p 值和 $\alpha$ 挂钩的决定(“因为 $0.026<0.05$,我们拒绝 $H_0$”)、“令人信服的证据”(或“没有令人信服的证据”)这一措辞,以及带方向的情境中的参数。只写“拒绝 $H_0$”是不完整的。

Check your understanding自我检测
A test gives p-value $0.07$ with $\alpha=0.05$. State the decision and write the conclusion for $H_a: p>0.30$ where $p$ is the true proportion of adults in a city who bike to work.某检验的 p 值为 $0.07$,$\alpha=0.05$。对 $H_a: p>0.30$($p$ 为某市成年人骑车上班的真实比例)写出决定和结论。

Because $0.07>0.05$, we fail to reject $H_0$. There is not convincing evidence that the true proportion of adults in this city who bike to work is greater than $0.30$.

因为 $0.07>0.05$,我们不拒绝 $H_0$。没有令人信服的证据表明该市成年人骑车上班的真实比例大于 $0.30$。

Compute $z$ for $H_0: p=0.60$, $n=200$, $\hat{p}=0.66$.计算 $H_0: p=0.60$、$n=200$、$\hat{p}=0.66$ 时的 $z$。

$z=\dfrac{0.66-0.60}{\sqrt{0.60(0.40)/200}}=\dfrac{0.06}{0.0346}\approx 1.73$.

$z=\dfrac{0.66-0.60}{\sqrt{0.60(0.40)/200}}=\dfrac{0.06}{0.0346}\approx 1.73$。

Why is "we accept $H_0$" never an acceptable conclusion?为什么“我们接受 $H_0$”永远不是可接受的结论?

A test measures evidence against $H_0$. A sample that is not extreme enough to reject $H_0$ is also consistent with many nearby values of $p$, so it cannot show $H_0$ is true.

检验衡量的是反对 $H_0$ 的证据。一个不够极端、不足以拒绝 $H_0$ 的样本,同样与附近许多 $p$ 值相符,因此不能说明 $H_0$ 为真。

Potential Errors When Performing Tests检验中可能出现的错误

Learning objectives学习目标
  • Define Type I and Type II errors in the context of a test.
  • State that the probability of a Type I error equals the significance level $\alpha$.
  • Define the power of a test and relate it to the probability of a Type II error.
  • Explain how sample size, significance level and effect size change power.
  • Describe the consequences of each error in a given context.
  • 在检验的情境中定义第一类错误与第二类错误。
  • 说明第一类错误的概率等于显著性水平 $\alpha$。
  • 定义检验的功效,并将其与第二类错误的概率联系起来。
  • 解释样本容量、显著性水平与效应大小如何改变功效。
  • 在给定情境中描述每种错误的后果。

A test can reach the wrong conclusion in two ways. A Type I error is rejecting $H_0$ when $H_0$ is actually true (a false alarm). A Type II error is failing to reject $H_0$ when $H_0$ is actually false (a missed detection). Describe each in context, naming the parameter and the claim.

检验可能以两种方式得出错误结论。第一类错误是在 $H_0$ 实际为真时拒绝了 $H_0$(虚报)。第二类错误是在 $H_0$ 实际为假时没有拒绝 $H_0$(漏报)。要结合情境描述,点明参数和说法。

$H_0$ is true$H_0$ is false
Reject $H_0$Type I errorcorrect (power)
Fail to reject $H_0$correctType II error
$H_0$ 为真$H_0$ 为假
拒绝 $H_0$第一类错误正确(功效)
不拒绝 $H_0$正确第二类错误

The probability of a Type I error equals the significance level $\alpha$: if $H_0$ is true and $\alpha=0.05$, the test falsely rejects about 5% of the time. The probability of a Type II error is written $\beta$. The power of a test is the probability that it correctly rejects a false $H_0$; power $=1-\beta$, and it depends on which alternative value of $p$ is true.

第一类错误的概率等于显著性水平 $\alpha$:若 $H_0$ 为真且 $\alpha=0.05$,检验约有 5% 的时间会错误地拒绝。第二类错误的概率记作 $\beta$。检验的功效是它正确拒绝一个为假的 $H_0$ 的概率;功效 $=1-\beta$,且取决于真实的 $p$ 取哪个备择值。

Power increases when (1) the sample size $n$ is larger, (2) the significance level $\alpha$ is larger (but then Type I errors become more likely), (3) the true value of $p$ is farther from $p_0$ (a larger effect size), and (4) the variability is smaller. Lowering the chance of one error by changing $\alpha$ raises the chance of the other; a larger sample can lower both error probabilities at once.

下列情形功效会增大:(1) 样本容量 $n$ 更大;(2) 显著性水平 $\alpha$ 更大(但第一类错误更易发生);(3) $p$ 的真实值离 $p_0$ 更远(效应大小更大);(4) 变异更小。通过改变 $\alpha$ 降低一类错误的可能性会提高另一类错误的可能性;增大样本则可以同时降低两类错误的概率。

0.30.3 0.40.4 0.50.5 0.60.6 0.70.7 0.80.8 reject H0 if p̂ > 0.582若 p̂ > 0.582 则拒绝 H0 if p = 0.5若 p = 0.5 if p = 0.6若 p = 0.6 α ≈ 0.05α ≈ 0.05 β ≈ 0.36β ≈ 0.36 sample proportion p̂ (n = 100)样本比例 p̂(n = 100)
Figure 6.6. Testing H0: p = 0.5 against Ha: p > 0.5 at α = 0.05 with n = 100. If p is really 0.5 (red curve), the right tail beyond 0.582 is the Type I error probability α. If p is really 0.6 (blue curve), the part left of 0.582 is the Type II error probability β, about 0.36, so power is about 0.64.图 6.6。n = 100、α = 0.05 时检验 H0:p = 0.5 对 Ha:p > 0.5。若 p 实际为 0.5(红色曲线),0.582 右侧的尾部是第一类错误概率 α。若 p 实际为 0.6(蓝色曲线),0.582 左侧的部分是第二类错误概率 β,约 0.36,所以功效约 0.64。
Worked Example: describing the errors in context例题:结合情境描述两类错误

A pharmacy's old process had a 12% error rate. It tests $H_0: p=0.12$ against $H_a: p<0.12$ after retraining, where $p$ is the true proportion of prescriptions filled with an error. Describe a Type I and a Type II error in context and a consequence of each. (Illustrative scenario.)

  1. Type I error. Concluding that the retraining lowered the error rate below $0.12$ when it is actually still $0.12$. Consequence: the pharmacy may stop other safety checks, believing the problem is fixed.
  2. Type II error. Failing to find convincing evidence of improvement when the error rate really is below $0.12$. Consequence: the pharmacy may drop an effective training program.
  3. Probabilities. The chance of a Type I error is $\alpha$, chosen in advance. The chance of a Type II error depends on the true $p$ and the sample size.

某药房旧流程的错误率为 12%。再培训后检验 $H_0: p=0.12$ 对 $H_a: p<0.12$,$p$ 为配药出错的真实比例。结合情境描述第一类与第二类错误,并各给出一个后果。(示意情境。)

  1. 第一类错误。在错误率实际仍为 $0.12$ 时,却断定再培训使错误率降到 $0.12$ 以下。后果:药房可能因以为问题已解决而停掉其他安全检查。
  2. 第二类错误。在错误率确实低于 $0.12$ 时,却没有找到令人信服的改进证据。后果:药房可能放弃一个有效的培训方案。
  3. 概率。第一类错误的概率是事先选定的 $\alpha$。第二类错误的概率取决于真实的 $p$ 与样本容量。
Worked Example: computing power for a specific alternative例题:对具体备择值计算功效

A coin-flip style test uses $H_0: p=0.5$ against $H_a: p>0.5$ at $\alpha=0.05$ with $n=100$. Find the power when the true proportion is $p=0.6$. This is an optional calculation that shows why power behaves as it does. (Illustrative.)

  1. Rejection cut-off under $H_0$. $\sigma_{\hat{p}}=\sqrt{\dfrac{0.5(0.5)}{100}}=0.050$. Reject $H_0$ when $\hat{p}>0.5+1.645(0.050)\approx 0.5822$.
  2. Distribution if $p=0.6$. Mean $0.6$, standard deviation $\sqrt{\dfrac{0.6(0.4)}{100}}\approx 0.0490$.
  3. Power. $P(\hat{p}>0.5822)=P\left(Z>\dfrac{0.5822-0.6}{0.0490}\right)=P(Z>-0.36)\approx 0.6415$ (the area uses the unrounded $z=-0.362$), so power $\approx 0.64$ and $\beta\approx 0.3585$.
  4. Meaning. If the true proportion is $0.6$, this test would detect it about 64% of the time. A 36% chance of a Type II error is high; Figure 6.6 shows it as the blue area left of the cut-off.

某检验取 $H_0: p=0.5$ 对 $H_a: p>0.5$,$\alpha=0.05$,$n=100$。求真实比例 $p=0.6$ 时的功效。这是一个可选的计算,用来说明功效为何如此变化。(示意。)

  1. $H_0$ 下的拒绝临界点。$\sigma_{\hat{p}}=\sqrt{\dfrac{0.5(0.5)}{100}}=0.050$。当 $\hat{p}>0.5+1.645(0.050)\approx 0.5822$ 时拒绝 $H_0$。
  2. 若 $p=0.6$ 的分布。均值 $0.6$,标准差 $\sqrt{\dfrac{0.6(0.4)}{100}}\approx 0.0490$。
  3. 功效。$P(\hat{p}>0.5822)=P\left(Z>\dfrac{0.5822-0.6}{0.0490}\right)=P(Z>-0.36)\approx 0.6415$(面积由未取整的 $z=-0.362$ 求得),所以功效 $\approx 0.64$,$\beta\approx 0.3585$。
  4. 含义。若真实比例是 $0.6$,该检验约有 64% 的时间能检出。第二类错误概率 36% 偏高;图 6.6 中它是临界点左侧的蓝色面积。
Worked Example: how n, alpha and the true value change power例题:n、α 与真实值如何改变功效

Continue from the previous example ($H_0: p=0.5$, $H_a: p>0.5$, $n=100$, $\alpha=0.05$, true $p=0.6$, power $\approx 0.64$). Find the power after each change separately. Each $z$ is shown rounded to two decimals; the power uses the unrounded value.

  1. (a) Increase $n$ to $400$. Cut-off $=0.5+1.645(0.0250)\approx 0.5411$; if $p=0.6$ the standard deviation is $\approx 0.0245$, so power $=P(Z>-2.40)\approx 0.9919$.
  2. (b) Raise $\alpha$ to $0.10$ (with $n=100$). Cut-off $=0.5+1.282(0.05)\approx 0.5641$; power $=P(Z>-0.73)\approx 0.7683$.
  3. (c) True $p=0.7$ instead of $0.6$ (with $n=100$, $\alpha=0.05$). Standard deviation $\approx 0.0458$; power $=P(Z>-2.57)\approx 0.9949$.
  4. Summary. A larger sample, a larger $\alpha$ and a bigger true difference all raise the power from $0.64$. Only the first two choices are under the researcher's control, and raising $\alpha$ makes Type I errors more likely.

延续上例($H_0: p=0.5$,$H_a: p>0.5$,$n=100$,$\alpha=0.05$,真实 $p=0.6$,功效 $\approx 0.64$)。分别求每项改变后的功效。每个 $z$ 都按两位小数显示;功效由未取整的值算出。

  1. (a) 把 $n$ 增至 $400$。临界点 $=0.5+1.645(0.0250)\approx 0.5411$;若 $p=0.6$,标准差 $\approx 0.0245$,功效 $=P(Z>-2.40)\approx 0.9919$。
  2. (b) 把 $\alpha$ 升至 $0.10$($n=100$)。临界点 $=0.5+1.282(0.05)\approx 0.5641$;功效 $=P(Z>-0.73)\approx 0.7683$。
  3. (c) 真实 $p=0.7$ 而不是 $0.6$($n=100$,$\alpha=0.05$)。标准差 $\approx 0.0458$;功效 $=P(Z>-2.57)\approx 0.9949$。
  4. 小结。更大的样本、更大的 $\alpha$ 和更大的真实差异,都使功效由 $0.64$ 上升。前两项由研究者控制,而提高 $\alpha$ 会使第一类错误更容易发生。
Common Mistake: mixing up alpha, beta and the p-value

$\alpha$ is set before the data and is the Type I error probability; the p-value is computed from the data. $\beta$ and power need a specific alternative value of $p$. Saying "the p-value is the probability of a Type I error" or "power is the probability $H_0$ is false" is a common mistake.

常见错误:混淆 α、β 与 p 值

$\alpha$ 在看数据之前设定,是第一类错误的概率;p 值由数据算出。$\beta$ 与功效需要 $p$ 的某个具体备择值。说“p 值是第一类错误的概率”或“功效是 $H_0$ 为假的概率”是常见错误。

Exam tip考试提示

When asked for an error "in context," write a full sentence that says what was concluded and what is actually true ("concluding that ... when in fact ..."). Do not just write the words Type I. For consequences, tie them to the setting (safety, cost, wrongly dropping a good program).

题目要求“结合情境”描述错误时,要写完整句子,说清得出了什么结论、实际情况又是什么(“断定……而实际上……”)。不要只写“第一类”几个字。后果要与情境挂钩(安全、成本、错误放弃好方案)。

Check your understanding自我检测
A medical screening test of $H_0$: "the patient does not have the disease" is evaluated. Describe a Type I error in context.对医学筛查的检验 $H_0$:“患者没有这种疾病”进行评估。结合情境描述第一类错误。

A Type I error is concluding that the patient has the disease when the patient actually does not (a false positive).

第一类错误是在患者实际没有病时,断定患者有这种疾病(假阳性)。

A test uses $\alpha=0.01$. If $H_0$ is true, what is the probability the test makes a Type I error?某检验取 $\alpha=0.01$。若 $H_0$ 为真,该检验犯第一类错误的概率是多少?

$0.01$. The probability of a Type I error equals the significance level.

$0.01$。第一类错误的概率等于显著性水平。

List two ways to increase the power of a test, and say which one carries a cost in Type I error.列出提高检验功效的两种方法,并说明哪一种会以第一类错误为代价。

Increase the sample size $n$ (no cost in Type I error); increase $\alpha$ (this raises the probability of a Type I error).

增大样本容量 $n$(不增加第一类错误);增大 $\alpha$(这会提高第一类错误的概率)。

Setting Up a Test for a Population Mean建立总体均值的检验

Learning objectives学习目标
  • Define the parameter $\mu$ in words with its population and units.
  • Write a null hypothesis $H_0:\mu=\mu_0$ and the correct alternative hypothesis in symbols and in words.
  • Choose a one-sided or two-sided alternative from the wording of the question before seeing the data.
  • State the conditions for a one-sample $t$ test and what each one protects.
  • 结合总体与单位用文字定义参数 $\mu$。
  • 用符号与文字写出零假设 $H_0:\mu=\mu_0$ 与正确的备择假设。
  • 在看数据之前,根据题意选择单侧或双侧备择假设。
  • 陈述单样本 $t$ 检验的条件,以及每个条件保护什么。

A significance test asks whether the sample provides convincing evidence against a specific claim about a parameter. The claim is the null hypothesis $H_0$; the suspicion that something differs is the alternative hypothesis $H_a$. For a population mean, the null hypothesis always states that $\mu$ equals one hypothesized value $\mu_0$:

显著性检验询问样本是否提供了令人信服的证据来反对某个关于参数的具体说法。该说法是零假设(null hypothesis)$H_0$;怀疑有差异的想法是备择假设(alternative hypothesis)$H_a$。对总体均值,零假设总是说 $\mu$ 等于某个假设值 $\mu_0$(hypothesized value):

Hypotheses for one mean

$H_0:\mu=\mu_0$ against one of $H_a:\mu<\mu_0$, $H_a:\mu>\mu_0$, or $H_a:\mu\ne\mu_0$. Define $\mu$ as the population mean of a named variable for a named population, with units. Hypotheses are about parameters ($\mu$), never about statistics ($\bar{x}$).

单个均值的假设

$H_0:\mu=\mu_0$,对立面为 $H_a:\mu<\mu_0$、$H_a:\mu>\mu_0$ 或 $H_a:\mu\ne\mu_0$ 之一。要把 $\mu$ 定义为某指定总体中某指定变量的总体均值(population mean),并带上单位。假设涉及参数($\mu$),绝不涉及统计量($\bar{x}$)。

Choose the form of $H_a$ from the research question, before looking at the data. Words such as "less than", "fewer" or "lower" give $H_a:\mu<\mu_0$; "greater than", "exceeds" or "more" give $H_a:\mu>\mu_0$; "differs from", "is different" or "has changed" give $H_a:\mu\ne\mu_0$. Choosing the direction after seeing which way $\bar{x}$ fell is not allowed because it halves the p-value dishonestly.

根据研究问题,在看数据之前确定 $H_a$ 的形式。“少于”“更少”“更低”等词对应 $H_a:\mu<\mu_0$;“大于”“超过”“更多”对应 $H_a:\mu>\mu_0$;“不同于”“有差异”“发生变化”对应 $H_a:\mu\ne\mu_0$。看到 $\bar{x}$ 的方向后再选方向是不允许的,因为这样会不诚实地把 p 值减半。

The conditions for the one-sample $t$ test are the same as for the interval, and you check them the same way. Random: a random sample or randomized experiment, so the sample represents the population. 10% condition: $n<10\%$ of the population, so observations are nearly independent. Normal or large sample: population approximately normal, or $n\ge 30$, or a sample graph without strong skew and outliers.

单样本 $t$ 检验的条件与区间的相同,检验方法也相同。随机:随机样本或随机化实验,使样本代表总体。10% 条件:$n<10\%$(占总体的比例),使观测近似独立。正态或大样本:总体近似正态,或 $n\ge 30$,或样本图形没有明显偏斜和离群点。

Worked Example 7.4a: a two-sided test about a labeled weight例题 7.4a:关于标称重量的双侧检验

The rice plant wants to know whether the mean bag weight differs from the labeled 500 g.

  1. Parameter: $\mu$ = the true mean weight (g) of all bags of rice produced at the plant that day (the population mean).
  2. Null hypothesis: $H_0:\mu=500$ g, so $\mu_0=500$.
  3. Alternative hypothesis: "differs from" is two-sided, $H_a:\mu\ne 500$ g.

大米厂想知道平均每袋重量是否不同于标称的 500 克。

  1. 参数:$\mu$ = 该厂当天生产的全部米袋的真实平均重量(克)(总体均值)。
  2. 零假设:$H_0:\mu=500$ 克,所以 $\mu_0=500$。
  3. 备择假设:“不同于”是双侧的,$H_a:\mu\ne 500$ 克。
Worked Example 7.4b: a one-sided test about battery life例题 7.4b:关于电池寿命的单侧检验

A consumer group suspects that batteries from a shipment last fewer than the claimed 10 hours.

  1. Parameter: $\mu$ = the true mean life (hours) of all batteries in the shipment.
  2. Hypotheses: $H_0:\mu=10$ hours; $H_a:\mu<10$ hours (the suspicion is "fewer").
  3. In words: the null says the mean life is exactly the claimed 10 hours; the alternative says it is less than 10 hours.

消费者组织怀疑一批电池的寿命少于所声称的 10 小时。

  1. 参数:$\mu$ = 这批货中全部电池的真实平均寿命(小时)。
  2. 假设:$H_0:\mu=10$ 小时;$H_a:\mu<10$ 小时(怀疑的是“更少”)。
  3. 用文字表述:零假设说平均寿命恰为所声称的 10 小时;备择假设说平均寿命少于 10 小时。
Worked Example 7.4c: correcting hypotheses that are written wrong例题 7.4c:改正写错的假设

A student writes "$H_0:\bar{x}=45$ and $H_a:\bar{x}\ge 45$" for a teacher's claim that the mean homework time is 45 minutes, which students think is too low.

  1. Statistic versus parameter: hypotheses are about the population mean $\mu$, not the sample mean $\bar{x}$.
  2. Form of $H_a$: "too low" means the true mean is greater, so use the strict inequality $H_a:\mu>45$; the null keeps the equality.
  3. Corrected: $H_0:\mu=45$ minutes, $H_a:\mu>45$ minutes, where $\mu$ is the true mean nightly homework time of all students at the school.

老师声称平均作业时间是 45 分钟,学生认为偏低。一名学生写成“$H_0:\bar{x}=45$,$H_a:\bar{x}\ge 45$”。

  1. 统计量与参数:假设针对总体均值 $\mu$,不是样本均值 $\bar{x}$。
  2. $H_a$ 的形式:“偏低”意味着真实均值更大,所以用严格不等号 $H_a:\mu>45$;零假设保留等号。
  3. 改正后:$H_0:\mu=45$ 分钟,$H_a:\mu>45$ 分钟,其中 $\mu$ 是该校全体学生每晚作业的真实平均时间。

Checking the Normal condition with a small sample小样本时检查正态条件

The $t$ procedures need the sampling distribution of $\bar{x}$ to be approximately normal. With $n\ge 30$ the central limit theorem usually supplies this, even for a skewed population. With a smaller sample the population itself must be approximately normal, and all you can do is look at the sample. Make a dotplot, histogram or boxplot of the data. For a very small sample (roughly $n<15$) the graph should be close to symmetric with no outliers; for a moderate sample a mild skew is tolerable, but strong skew or an outlier is not.

A graph cannot prove that a population is normal; it can only reveal a reason to doubt it. So report what you see: "The dotplot of the 12 readings is roughly symmetric with no outliers, so the Normal condition is reasonable." If a small sample shows strong skew or an outlier, say that a $t$ test is not appropriate for these data instead of carrying on.

$t$ 方法要求 $\bar{x}$ 的抽样分布近似正态。当 $n\ge 30$ 时,中心极限定理通常能保证这一点,即使总体偏斜。样本较小时,总体本身必须近似正态,而你能做的只是观察样本。画出数据的点图、直方图或箱线图。对于很小的样本(大致 $n<15$),图形应接近对称且没有离群值;对于中等样本,轻度偏斜可以接受,但强烈偏斜或存在离群值则不可以。

图形不能证明总体是正态的,只能揭示怀疑的理由。所以要写出你看到的情况:“12 个读数的点图大致对称且没有离群值,所以正态条件是合理的。”如果小样本显示强烈偏斜或有离群值,应说明这些数据不适合用 $t$ 检验,而不是继续计算。

Exam tip考试提示

Always begin with a sentence defining $\mu$: "Let $\mu$ = the true mean ___ (units) of all ___." A missing or vague definition is an incomplete answer even when the symbols are right. The null hypothesis contains only an equals sign, and the alternative must match the direction in the question.

总是先用一句话定义 $\mu$:“设 $\mu$ = 全体 ___ 的真实平均 ___(单位)。”即使符号正确,缺少或含糊的定义也是不完整的作答。零假设只含等号,备择假设必须与题目中的方向一致。

Common Mistake: sample results in the hypotheses and a late choice of direction
  • Using $\bar{x}$ or a sample result in $H_0$ or $H_a$.
  • Writing $H_0:\mu\ge\mu_0$ or an alternative with $\ge$ or $\le$.
  • Deciding between one-sided and two-sided after seeing the data.
常见错误:把样本结果写进假设与事后选择方向
  • 在 $H_0$ 或 $H_a$ 中使用 $\bar{x}$ 或样本结果。
  • 写 $H_0:\mu\ge\mu_0$,或备择假设带 $\ge$、$\le$。
  • 看过数据后才决定单侧还是双侧。
Check your understanding自我检测
A coffee shop says its mean wait is 3 minutes. A customer thinks it is longer. Write $H_0$ and $H_a$.咖啡店称平均等候时间是 3 分钟。一位顾客认为更长。写出 $H_0$ 与 $H_a$。

Let $\mu$ be the true mean wait time (minutes) of all customers at the shop. $H_0:\mu=3$; $H_a:\mu>3$.

设 $\mu$ 为该店全体顾客的真实平均等候时间(分钟)。$H_0:\mu=3$;$H_a:\mu>3$。

A school wants to know whether the mean score on a new test differs from the old mean of 72. Is the alternative one-sided or two-sided?学校想知道新测验的平均分是否不同于旧均值 72。备择假设是单侧还是双侧?

Two-sided: "differs from" allows either direction, so $H_a:\mu\ne 72$.

双侧:“不同于”允许任一方向,所以 $H_a:\mu\ne 72$。

Why must the Normal condition be checked in context for a test about $\mu$ when $n=18$?当 $n=18$ 时,为什么对 $\mu$ 的检验必须结合情境检验正态条件?

With $n<30$ the Central Limit Theorem does not guarantee a nearly normal sampling distribution of $\bar{x}$, so a graph of the sample must show no strong skew and no outliers before the $t$ model can be used.

$n<30$ 时,中心极限定理不能保证 $\bar{x}$ 的抽样分布近似正态,所以必须由样本图形显示没有明显偏斜和离群点,才能使用 $t$ 模型。

Carrying Out a Test for a Population Mean实施总体均值的检验

Learning objectives学习目标
  • Calculate the one-sample $t$ test statistic and its degrees of freedom.
  • Find the p-value from a $t$ distribution with a calculator (tcdf or T-Test) for one-sided and two-sided alternatives.
  • Make a decision by comparing the p-value with $\alpha$ and write a conclusion in context.
  • Use the words "reject", "fail to reject" and "convincing evidence" correctly.
  • Explain what a p-value means and what it does not mean.
  • 计算单样本 $t$ 检验统计量及其自由度。
  • 用计算器(tcdf 或 T-Test)由 $t$ 分布求单侧与双侧的 p 值。
  • 通过比较 p 值与 $\alpha$ 作出决定,并结合情境写出结论。
  • 正确使用“拒绝”“不拒绝”和“令人信服的证据”这些措辞。
  • 解释 p 值的含义及其不意味着什么。

After the hypotheses and conditions are set, measure how far the sample mean is from the hypothesized mean in units of standard error. The test statistic is

在假设与条件确定后,用标准误为单位衡量样本均值与假设均值的距离。检验统计量是

One-sample t test

$$t=\dfrac{\bar{x}-\mu_0}{s/\sqrt{n}},\qquad df=n-1$$ The p-value is the probability, computed assuming $H_0$ is true, of getting a sample mean at least as far from $\mu_0$ as the observed one, in the direction(s) of $H_a$. TI-84: STAT, right arrow to TESTS, then 2:T-Test; or use tcdf(lower,upper,df). For $H_a:\mu\ne\mu_0$, double the one-tail area.

单样本 t 检验

$$t=\dfrac{\bar{x}-\mu_0}{s/\sqrt{n}},\qquad df=n-1$$ p 值(p-value)是在 $H_0$ 为真的前提下,得到与 $\mu_0$ 的距离至少和观测值一样远的样本均值(按 $H_a$ 的方向)的概率。TI-84:STAT,用右方向键移到 TESTS,再选 2:T-Test;或用 tcdf(下限,上限,df)。对 $H_a:\mu\ne\mu_0$,要把单侧面积加倍。

Carry out a test in four steps. State the hypotheses with $\mu$ defined and a significance level $\alpha$ (use $0.05$ if none is given). Plan by naming the procedure (one-sample $t$ test for $\mu$) and checking the conditions. Do the mathematics: $\bar{x}$, $s$, $n$, $t$, $df$ and the p-value. Conclude by comparing the p-value with $\alpha$ and answering in context.

检验分四步进行。陈述假设,定义 $\mu$,并给出显著性水平 $\alpha$(未给出时用 $0.05$)。计划:写出程序名称(针对 $\mu$ 的单样本 $t$ 检验)并检验条件。计算:$\bar{x}$、$s$、$n$、$t$、$df$ 与 p 值。结论:把 p 值与 $\alpha$ 比较,并结合情境(in context)回答。

Interpreting the p-value and writing the conclusion解释 p 值并写出结论

If the p-value is less than or equal to $\alpha$, reject $H_0$: the data provide convincing evidence for $H_a$. If the p-value is greater than $\alpha$, fail to reject $H_0$: the data do not provide convincing evidence for $H_a$. Failing to reject is never the same as accepting $H_0$ or proving it true; it only says the sample was not extreme enough. A p-value is not the probability that $H_0$ is true; it is the probability of data this extreme if $H_0$ were true.

若 p 值小于或等于 $\alpha$,则拒绝 $H_0$:数据提供了支持 $H_a$ 的令人信服的证据(convincing evidence)。若 p 值大于 $\alpha$,则不拒绝(fail to reject)$H_0$:数据没有提供支持 $H_a$ 的令人信服的证据。不拒绝绝不等于接受或证明 $H_0$ 为真,它只说明样本不够极端。p 值不是 $H_0$ 为真的概率,而是假如 $H_0$ 为真时出现如此极端数据的概率。

Worked Example 7.5a: a left-tailed t test for battery life例题 7.5a:电池寿命的左侧 t 检验

Use the battery sample ($n=30$, $\bar{x}=9.42$ h, $s=1.1$ h) to test whether the true mean life is less than the claimed 10 hours at $\alpha=0.05$.

  1. State: $\mu$ = true mean life (hours) of all batteries in the shipment. $H_0:\mu=10$; $H_a:\mu<10$; $\alpha=0.05$.
  2. Plan: one-sample $t$ test for $\mu$. Random sample (given); 30 is under 10% of a large shipment; $n\ge 30$.
  3. Do: $t=\dfrac{9.42-10}{1.1/\sqrt{30}}=\dfrac{-0.58}{0.2008}=-2.89$, $df=29$. p-value $=$ tcdf(-1E99,-2.89,29) $\approx 0.0036$. (T-Test: $\mu_0=10$, $\bar{x}=9.42$, Sx$=1.1$, $n=30$, $\mu<\mu_0$.)
  4. Conclude: the p-value 0.0036 is less than $0.05$, so reject $H_0$. There is convincing evidence that the true mean life of batteries in this shipment is less than 10 hours.

用电池样本($n=30$,$\bar{x}=9.42$ 小时,$s=1.1$ 小时)在 $\alpha=0.05$ 下检验真实平均寿命是否少于所声称的 10 小时。

  1. 陈述:$\mu$ = 这批货中全部电池的真实平均寿命(小时)。$H_0:\mu=10$;$H_a:\mu<10$;$\alpha=0.05$。
  2. 计划:针对 $\mu$ 的单样本 $t$ 检验。随机样本(已知);30 少于大批货的 10%;$n\ge 30$。
  3. 计算:$t=\dfrac{9.42-10}{1.1/\sqrt{30}}=\dfrac{-0.58}{0.2008}=-2.89$,$df=29$。p 值 $=$ tcdf(-1E99,-2.89,29) $\approx 0.0036$。(T-Test:$\mu_0=10$、$\bar{x}=9.42$、Sx$=1.1$、$n=30$、$\mu<\mu_0$。)
  4. 结论:p 值 0.0036 小于 $0.05$,拒绝 $H_0$。有令人信服的证据表明这批电池的真实平均寿命少于 10 小时。
Worked Example 7.5b: a two-sided test that fails to reject例题 7.5b:不拒绝的双侧检验

A course page states that the mean quiz-completion time is 40 minutes. A random sample of 12 completion times has $\bar{x}=40.91$ and $s=1.93$ (illustrative data). Test whether the mean differs from 40 at $\alpha=0.05$.

  1. State: $\mu$ = true mean quiz-completion time (minutes) of all students in the course. $H_0:\mu=40$; $H_a:\mu\ne 40$.
  2. Plan: one-sample $t$ test. Random sample; 12 is under 10% of the course; boxplot shows no outliers and no strong skew.
  3. Do: $t=\dfrac{40.91-40}{1.93/\sqrt{12}}=\dfrac{40.91-40}{0.557}=1.63$, $df=11$. One tail: tcdf(1.63,1E99,11) $\approx 0.066$; two-sided p-value $\approx 2(0.0657)\approx 0.131$ (Figure 7.3 shows this area).
  4. Conclude: the p-value 0.131 is greater than $0.05$, so fail to reject $H_0$. There is not convincing evidence that the mean quiz-completion time for all students in the course differs from 40 minutes.

课程页面称测验平均完成时间是 40 分钟。随机抽取 12 个完成时间,得 $\bar{x}=40.91$,$s=1.93$(示意数据)。在 $\alpha=0.05$ 下检验平均时间是否不同于 40。

  1. 陈述:$\mu$ = 该课程全体学生测验完成时间的真实平均值(分钟)。$H_0:\mu=40$;$H_a:\mu\ne 40$。
  2. 计划:单样本 $t$ 检验。随机样本;12 人少于课程总人数的 10%;箱线图无离群点、无明显偏斜。
  3. 计算:$t=\dfrac{40.91-40}{1.93/\sqrt{12}}=\dfrac{40.91-40}{0.557}=1.63$,$df=11$。单侧:tcdf(1.63,1E99,11) $\approx 0.066$;双侧 p 值 $\approx 2(0.0657)\approx 0.131$(图 7.3 显示了该面积)。
  4. 结论:p 值 0.131 大于 $0.05$,不拒绝 $H_0$。没有令人信服的证据表明该课程全体学生测验完成的平均时间不同于 40 分钟。
−1.63−1.63001.631.630.0660.0660.0660.066p-value = 0.131p 值 = 0.131(both tails)(两侧尾部)t statistic, df = 11t 统计量,df = 11
Figure 7.3. A two-sided test with $t=1.63$ and $df=11$: the shaded area beyond $\pm 1.63$ is 0.066 in each tail, so the p-value is $\approx 0.131$.图 7.3。双侧检验中 $t=1.63$、$df=11$:$\pm 1.63$ 之外的阴影面积每侧 0.066,所以 p 值是 $\approx 0.131$。
Worked Example 7.5c: the test agrees with the interval例题 7.5c:检验与区间一致

Test the label claim $H_0:\mu=500$ g against $H_a:\mu\ne 500$ g with the rice sample ($n=25$, $\bar{x}=498.4$, $s=6.5$), $\alpha=0.05$.

  1. Statistic: $t=\dfrac{498.4-500}{6.5/\sqrt{25}}=\dfrac{-1.6}{1.3}=-1.23$, $df=24$.
  2. p-value: $2\cdot$tcdf(-1E99,-1.23,24) $\approx 0.230$.
  3. Conclude: 0.230 is greater than $0.05$, so fail to reject $H_0$. There is not convincing evidence that the mean weight of bags produced that day differs from 500 g.
  4. Check with an interval: the 95% confidence interval $498.4\pm 2.064(1.3)=(495.72,\,501.08)$ contains 500, which is the same decision as a two-sided 0.05 test.

用大米样本($n=25$,$\bar{x}=498.4$,$s=6.5$)在 $\alpha=0.05$ 下检验标签说法 $H_0:\mu=500$ 克对 $H_a:\mu\ne 500$ 克。

  1. 统计量:$t=\dfrac{498.4-500}{6.5/\sqrt{25}}=\dfrac{-1.6}{1.3}=-1.23$,$df=24$。
  2. p 值:$2\cdot$tcdf(-1E99,-1.23,24) $\approx 0.230$。
  3. 结论:0.230 大于 $0.05$,不拒绝 $H_0$。没有令人信服的证据表明当天所生产米袋的平均重量不同于 500 克。
  4. 用区间核对:95% 置信区间 $498.4\pm 2.064(1.3)=(495.72,\,501.08)$ 包含 500,与双侧 0.05 水平检验的决定一致。

Reading calculator or computer output for a $t$ test读懂 $t$ 检验的计算器或计算机输出

A lab says its sensor reads $50$ units on a calibration standard; a technician suspects it reads low. Twenty random readings (from an approximately normal distribution of readings) give $\bar{x}=48.2$ and $s=3.77$. The output of T-Test or statistics software lists: $\mu<50$, $t=-2.14$, $p=0.023$, $\bar{x}=48.2$, $s_x=3.77$, $n=20$.

  1. Check the first line: $\mu<50$ must match the alternative in the question.
  2. Interpret $t$: the sample mean is about $2.14$ standard errors below $50$. You can confirm it: $\dfrac{48.2-50}{3.77/\sqrt{20}}\approx -2.14$, and $df=n-1=19$.
  3. Use the p-value as printed: $0.023$ is already one-sided because the alternative is. A calculator's two-sided output has the doubling built in, so never double it again.
  4. Conclude: since $0.023\le 0.05$, reject $H_0$; the data provide convincing evidence that the true mean reading of this sensor is less than $50$ units.

Output gives numbers, not a decision. You still write the hypotheses, check the conditions and state the conclusion in context.

某实验室称其传感器在校准标准上读数为 $50$ 个单位;技术员怀疑读数偏低。随机取 20 个读数(来自近似正态的读数分布),得 $\bar{x}=48.2$,$s=3.77$。T-Test 或统计软件的输出为:$\mu<50$,$t=-2.14$,$p=0.023$,$\bar{x}=48.2$,$s_x=3.77$,$n=20$。

  1. 先看第一行:$\mu<50$ 必须与题目中的备择假设一致。
  2. 解释 $t$:样本均值比 $50$ 低约 $2.14$ 个标准误。可以验证:$\dfrac{48.2-50}{3.77/\sqrt{20}}\approx -2.14$,且 $df=n-1=19$。
  3. 直接使用输出的 p 值:$0.023$ 因备择假设为单侧而已是单侧 p 值。计算器的双侧输出已经包含加倍,所以不要再加倍一次。
  4. 结论:因为 $0.023\le 0.05$,拒绝 $H_0$;数据提供了令人信服的证据表明该传感器的真实平均读数小于 $50$ 个单位。

输出只给出数字,不给出决定。假设、条件检查和情境中的结论仍需你自己写出。

Exam tip考试提示

Conclusions need three ingredients: the comparison ("the p-value of 0.0036 is less than $\alpha=0.05$"), the decision about $H_0$ ("reject" or "fail to reject"), and a statement about $H_a$ in context using "convincing evidence". Never write "accept $H_0$" or "prove". If the question states $\alpha$, use that value.

结论需要三个要素:比较(“p 值 0.0036 小于 $\alpha=0.05$”)、对 $H_0$ 的决定(“拒绝”或“不拒绝”),以及结合情境、使用“令人信服的证据”对 $H_a$ 的陈述。绝不要写“接受 $H_0$”或“证明”。如果题目给出了 $\alpha$,就使用该值。

Common Mistake: wrong tail area, wrong distribution, wrong meaning
  • Forgetting to double the tail area for a two-sided alternative.
  • Using $z$ (normalcdf) instead of $t$ (tcdf) for a mean.
  • Interpreting the p-value as the probability that $H_0$ is true.
常见错误:尾部面积、分布与含义用错
  • 双侧备择假设时忘记把尾部面积加倍。
  • 对均值使用 $z$(normalcdf)而不是 $t$(tcdf)。
  • 把 p 值解释为 $H_0$ 为真的概率。
Check your understanding自我检测
A one-sample $t$ test of $H_a:\mu>\mu_0$ with $df=15$ gives $t=1.80$. Is the one-sided p-value above or below 0.05? (Use $t^*=1.753$ for 95%, one tail, $df=15$.)对 $H_a:\mu>\mu_0$ 的单样本 $t$ 检验,$df=15$,得 $t=1.80$。单侧 p 值高于还是低于 0.05?($df=15$ 时单侧 5% 的 $t^*=1.753$。)

Below 0.05. The statistic 1.80 is beyond the critical value 1.753, so the tail area to its right is less than 0.05; reject $H_0$ at $\alpha=0.05$.

低于 0.05。统计量 1.80 超过临界值 1.753,所以其右侧尾部面积小于 0.05;在 $\alpha=0.05$ 下拒绝 $H_0$。

A test gives p-value $0.08$ with $\alpha=0.05$. Write the conclusion about a mean time $\mu$ (minutes) in context.检验得 p 值 $0.08$,$\alpha=0.05$。结合情境写出关于平均时间 $\mu$(分钟)的结论。

Since $0.08>0.05$, fail to reject $H_0$. The data do not provide convincing evidence for the alternative that the true mean time differs from the hypothesized value.

由于 $0.08>0.05$,不拒绝 $H_0$。数据没有提供令人信服的证据支持真实平均时间不同于假设值的备择假设。

A sample of $n=20$ gives $\bar{x}=52.1$, $s=6.0$. Test $H_0:\mu=50$ against $H_a:\mu\ne 50$: find $t$ and $df$.$n=20$ 的样本得 $\bar{x}=52.1$、$s=6.0$。检验 $H_0:\mu=50$ 对 $H_a:\mu\ne 50$:求 $t$ 与 $df$。

$t=\dfrac{52.1-50}{6.0/\sqrt{20}}=\dfrac{2.1}{1.3416}=1.57$ with $df=19$. The two-sided p-value is about 0.13, so fail to reject at $\alpha=0.05$.

$t=\dfrac{52.1-50}{6.0/\sqrt{20}}=\dfrac{2.1}{1.3416}=1.57$,$df=19$。双侧 p 值约为 0.13,所以在 $\alpha=0.05$ 下不拒绝。

Exam Toolkit考试工具

If the question saysWrite
Construct and interpret a confidence interval for $p$Parameter in words; one-sample $z$-interval; random, 10% condition, $n\hat{p}\ge 10$ and $n(1-\hat{p})\ge 10$; $\hat{p}\pm z^*\,SE$ with numbers; "We are $C$% confident that the interval from ... to ... captures the true proportion of ... "
Does the data support the claim $p=p_0$?Either an interval (contains $p_0$ or not) or a test; conclude in context with "convincing evidence" wording
Perform a test about $p$State: $H_0$, $H_a$, $\alpha$, parameter. Plan: test name, conditions with $np_0$, $n(1-p_0)$. Do: $z$, p-value. Conclude: compare p-value with $\alpha$, reject or fail to reject, in context
Perform a test about $\mu$State: $\mu$ defined with units, $H_0:\mu=\mu_0$, $H_a$, $\alpha$. Plan: one-sample $t$ test; random, 10% condition, Normal population or $n\ge 30$ or a sample graph with no strong skew or outliers. Do: $t=\dfrac{\bar{x}-\mu_0}{s/\sqrt{n}}$, $df=n-1$, p-value. Conclude: compare p-value with $\alpha$, reject or fail to reject, with "convincing evidence" wording in context
Interpret the p-value"Assuming ... (the null value) is true, the probability of a sample proportion at least as extreme as ... is ..."
Describe a Type I or Type II errorType I: concluding $H_a$ when $H_0$ is true; Type II: not rejecting $H_0$ when $H_a$ is true; in context; $P(\text{Type I})=\alpha$
Compare two proportionsInterval: unpooled SE, check whether it contains 0. Test: $H_0: p_1=p_2$, pooled $\hat{p}_c$, two-proportion $z$; independence from random samples or random assignment
Sample size for a margin of error$n\ge(z^*/ME)^2p^*(1-p^*)$ with $p^*=0.5$ if unknown; round up
题目说写什么
构造并解释 $p$ 的置信区间用文字写参数;单样本 $z$ 区间;随机、10% 条件、$n\hat{p}\ge 10$ 且 $n(1-\hat{p})\ge 10$;带数字的 $\hat{p}\pm z^*\,SE$;“我们有 $C$% 的把握认为,从 ... 到 ... 的区间覆盖了……的真实比例”
数据是否支持 $p=p_0$ 的说法?用区间(含不含 $p_0$)或检验均可;用“令人信服的证据”的措辞结合情境作结论
对 $p$ 作检验State:$H_0$、$H_a$、$\alpha$、参数。Plan:检验名称、带 $np_0$、$n(1-p_0)$ 的条件。Do:$z$、p 值。Conclude:比较 p 值与 $\alpha$,拒绝或不拒绝,结合情境
对 $\mu$ 作检验State:带单位定义 $\mu$,写出 $H_0:\mu=\mu_0$、$H_a$、$\alpha$。Plan:单样本 $t$ 检验;随机、10% 条件,总体近似正态或 $n\ge 30$ 或样本图形无明显偏斜和离群点。Do:$t=\dfrac{\bar{x}-\mu_0}{s/\sqrt{n}}$,$df=n-1$,p 值。Conclude:比较 p 值与 $\alpha$,拒绝或不拒绝,结合情境使用“令人信服的证据”的措辞
解释 p 值“假定……(原假设取值)为真,得到至少与……一样极端的样本比例的概率为……”
描述第一类或第二类错误第一类:$H_0$ 为真时断定 $H_a$;第二类:$H_a$ 为真时没有拒绝 $H_0$;结合情境;$P(\text{Type I})=\alpha$
比较两个比例区间:未合并的标准误,看是否含 0。检验:$H_0: p_1=p_2$,合并 $\hat{p}_c$,两比例 $z$;独立性来自随机样本或随机分配
给定误差范围求样本容量$n\ge(z^*/ME)^2p^*(1-p^*)$,未知时取 $p^*=0.5$;向上取整
Vocabulary checklist

sampling distribution, sample proportion, standard error, critical value, margin of error, confidence interval, confidence level, 10% condition, successes and failures, null hypothesis, alternative hypothesis, one-sided, two-sided, significance level, p-value, test statistic, reject, fail to reject, convincing evidence, Type I error, Type II error, power, pooled proportion, two-proportion $z$-test.

词汇清单

抽样分布、样本比例、标准误、临界值、误差范围、置信区间、置信水平、10% 条件、成功与失败、原假设、备择假设、单侧、双侧、显著性水平、p 值、检验统计量、拒绝、不拒绝、令人信服的证据、第一类错误、第二类错误、功效、合并比例、两比例 $z$ 检验。

Unit FRQ: A Test and an Interval单元简答题:检验与区间

AP FRQ-style response modelAP 简答题示范作答

Prompt. A school cafeteria served lunch to 55% of students last year. After a menu change, a random sample of 240 students (the school has 3,000 students) is surveyed and 150 bought lunch. (a) State the hypotheses to test whether the proportion buying lunch has increased. (b) Check the conditions and carry out the test at $\alpha=0.05$. (c) State your conclusion in context. (d) Construct a 95% confidence interval for the proportion now buying lunch and explain what it adds. (e) Describe a Type I error in this context.

PartWhat a complete answer states
(a)$p$ = the true proportion of all students at this school who now buy lunch. $H_0: p=0.55$, $H_a: p>0.55$.
(b)One-proportion $z$-test. Random sample; $240\le 0.10(3000)=300$; $np_0=240(0.55)=132\ge 10$ and $n(1-p_0)=108\ge 10$. $\hat{p}=150/240=0.625$; $z=\dfrac{0.625-0.55}{\sqrt{0.55(0.45)/240}}=\dfrac{0.075}{0.0321}\approx 2.34$, rounded from $2.3355$; p-value $\approx 0.0098$, found from the unrounded $z$.
(c)Because the p-value of about $0.010$ is less than $0.05$, we reject $H_0$. There is convincing evidence that the true proportion of students at this school who buy lunch is greater than $0.55$ after the menu change.
(d)Conditions as before with $n\hat{p}=150$ and $n(1-\hat{p})=90$. $0.625\pm1.960\sqrt{0.625(0.375)/240}=0.625\pm0.0612$, that is $(0.564,\,0.686)$. We are 95% confident that the interval from $0.564$ to $0.686$ captures the true proportion of students who now buy lunch. It adds a range for the size of the increase; every value is above $0.55$.
(e)Concluding that the proportion of students buying lunch has increased above $0.55$ when it is in fact still $0.55$ (for example, the sample was high by chance).

题目。某校食堂去年有 55% 的学生购买午餐。菜单调整后,随机抽取 240 名学生(全校 3,000 名学生)调查,其中 150 人购买了午餐。(a) 写出检验购买午餐的比例是否上升的假设。(b) 检验条件并在 $\alpha=0.05$ 下完成检验。(c) 结合情境写出结论。(d) 构造现在购买午餐比例的 95% 置信区间,并说明它提供了什么额外信息。(e) 结合此情境描述第一类错误。

部分完整答案要点
(a)$p$ = 该校全体学生中现在购买午餐的真实比例。$H_0: p=0.55$,$H_a: p>0.55$。
(b)单比例 $z$ 检验。随机样本;$240\le 0.10(3000)=300$;$np_0=240(0.55)=132\ge 10$,$n(1-p_0)=108\ge 10$。$\hat{p}=150/240=0.625$;$z=\dfrac{0.625-0.55}{\sqrt{0.55(0.45)/240}}=\dfrac{0.075}{0.0321}\approx 2.34$(由 $2.3355$ 取整);p 值 $\approx 0.0098$,由未取整的 $z$ 求得。
(c)因为 p 值约 $0.010$ 小于 $0.05$,我们拒绝 $H_0$。有令人信服的证据表明,菜单调整后该校购买午餐的学生真实比例大于 $0.55$。
(d)条件同上,$n\hat{p}=150$,$n(1-\hat{p})=90$。$0.625\pm1.960\sqrt{0.625(0.375)/240}=0.625\pm0.0612$,即 $(0.564,\,0.686)$。我们有 95% 的把握认为,从 $0.564$ 到 $0.686$ 的区间覆盖了现在购买午餐的学生真实比例。它额外给出了增幅大小的范围;区间内每个值都高于 $0.55$。
(e)在购买午餐比例实际上仍是 $0.55$ 时,断定它已上升到 $0.55$ 以上(例如样本偶然偏高)。

Common Errors and Their Corrections常见错误与修正

ErrorCorrection
Writing $H_0: \hat{p}=p_0$Hypotheses are about parameters: $H_0: p=p_0$
Using $\hat{p}$ in the standard error of a testA test uses $p_0$ (and pooled $\hat{p}_c$ for two proportions)
Saying "95% chance $p$ is in this interval"The 95% describes the method over repeated samples
Checking counts with $\hat{p}$ for a testCheck $np_0\ge 10$ and $n(1-p_0)\ge 10$
Writing "accept $H_0$"Fail to reject; there is not convincing evidence
Calling the p-value the probability $H_0$ is trueIt is the probability, assuming $H_0$, of a result at least as extreme
Conclusion without context or without the p-value linkName the population and variable and cite p-value versus $\alpha$
Concluding "equal" when an interval for $p_1-p_2$ contains 0Zero is plausible, not proven
Pooling in an interval or not pooling in a testInterval: unpooled; test of $p_1=p_2$: pooled
错误修正
写 $H_0: \hat{p}=p_0$假设针对参数:$H_0: p=p_0$
在检验的标准误中使用 $\hat{p}$检验使用 $p_0$(两比例用合并的 $\hat{p}_c$)
说“$p$ 在此区间的概率为 95%”95% 描述的是重复抽样下的方法
检验时用 $\hat{p}$ 检查计数应检查 $np_0\ge 10$ 与 $n(1-p_0)\ge 10$
写“接受 $H_0$”应写不拒绝;没有令人信服的证据
把 p 值说成 $H_0$ 为真的概率它是假定 $H_0$ 时得到至少一样极端结果的概率
结论没有情境或没有与 p 值挂钩点明总体与变量,并引用 p 值与 $\alpha$ 的比较
$p_1-p_2$ 的区间含 0 就断定“相等”0 是合理的,但没有被证明
区间里合并或检验里不合并区间:不合并;$p_1=p_2$ 的检验:合并

Flashcards闪卡

Select a card to reveal the answer.

点击卡片查看答案。

Unit Quiz单元自测

Choose an answer to see feedback.

选择答案查看反馈。

1. A 95% interval for $p$ is $(0.30,\,0.37)$. For $H_0: p=0.40$ against $H_a: p\ne 0.40$ at $\alpha=0.05$, the interval suggests

A. The interval does not contain $0.40$, so $0.40$ is not plausible.

1. $p$ 的 95% 区间为 $(0.30,\,0.37)$。对 $H_0: p=0.40$ 对 $H_a: p\ne 0.40$($\alpha=0.05$),该区间表明

A。区间不含 $0.40$,所以 $0.40$ 不合理。

2. A test has p-value $0.03$. This means

B. A p-value is computed assuming $H_0$.

2. 某检验的 p 值为 $0.03$。这意味着

B。p 值是在假定 $H_0$ 成立下算出的。

3. For $H_a: p>0.5$ the test statistic is $z=1.50$. The p-value is closest to

A. $P(Z\ge 1.50)\approx 0.0668$. The doubled value $0.1336$ would be for a two-sided test.

3. 对 $H_a: p>0.5$,检验统计量为 $z=1.50$。p 值最接近

A。$P(Z\ge 1.50)\approx 0.0668$。加倍后的 $0.1336$ 适用于双侧检验。

4. In a test of $H_0$: "the new drug is no better than the old drug," a Type II error is

B. A Type II error fails to reject a false $H_0$.

4. 在检验 $H_0$:“新药不比旧药好”时,第二类错误是

B。第二类错误是未拒绝一个为假的 $H_0$。

5. Which change increases the power of a test (all else equal)?

C. More data reduce variability and make a real difference easier to detect.

5. (其他条件不变)下列哪项改变会提高检验的功效?

C。更多数据减小变异,使真实差异更容易被检出。

6. A random sample of $n=18$ is used to test a mean. A dotplot shows strong right skew and one extreme outlier. The correct decision is

C. With $n<30$ the graph must show no strong skew and no outliers.

6. 用 $n=18$ 的随机样本检验均值。点图显示强烈右偏并有一个极端离群点。正确的做法是

C。$n<30$ 时图形必须没有明显偏斜和离群点。

7. A teacher claims the mean nightly homework time is 45 minutes; students believe it is more. The hypotheses are

A. Hypotheses use the parameter $\mu$ and the alternative matches the word "more".

7. 老师称平均每晚作业时间为 45 分钟;学生认为更长。假设是

A。假设使用参数 $\mu$,备择假设与“更长”一致。

8. A two-sided one-sample $t$ test has $t=-2.10$ with $df=24$. The p-value is closest to

B. One tail is about 0.023; doubling for a two-sided alternative gives 0.046.

8. 双侧单样本 $t$ 检验得 $t=-2.10$,$df=24$。p 值最接近

B。单侧约 0.023;双侧备择假设需加倍,得 0.046。

9. For $H_0: p=0.40$ with $n=200$ and $\hat{p}=0.47$, the standard error used in the test statistic is closest to

C. A test uses the null value: $\sqrt{0.40(0.60)/200}=\sqrt{0.0012}\approx 0.0346$. A uses $\hat{p}$ instead of $p_0$, B forgets the square root, and D doubles the correct value.

9. 对 $H_0: p=0.40$,$n=200$,$\hat{p}=0.47$,检验统计量中使用的标准误最接近

C。检验使用零假设的值:$\sqrt{0.40(0.60)/200}=\sqrt{0.0012}\approx 0.0346$。A 用了 $\hat{p}$ 而不是 $p_0$,B 忘记开平方,D 把正确值加倍。

10. A two-sided $z$ test gives $z=1.80$. The p-value is closest to

D. The upper tail is $P(Z>1.80)\approx 0.036$; a two-sided alternative doubles it to $0.072$. A is only one tail, B is the area below $z=1.80$, and C is the area between $-1.80$ and $1.80$.

10. 双侧 $z$ 检验得 $z=1.80$。p 值最接近

D。上尾为 $P(Z>1.80)\approx 0.036$;双侧备择假设需加倍,得 $0.072$。A 只有一侧,B 是 $z=1.80$ 左侧的面积,C 是 $-1.80$ 到 $1.80$ 之间的面积。

11. A test of $H_0: p=0.30$ against $H_a: p\ne 0.30$ gives a p-value of $0.12$ with $\alpha=0.05$. Which conclusion is best?

B. Since $0.12>0.05$ we fail to reject $H_0$, which means the evidence is not convincing, not that $H_0$ is proven (A). The p-value is computed assuming $H_0$ is true, so it is not the probability that $H_0$ is true (C). D would need a p-value of at most $0.05$.

11. 检验 $H_0: p=0.30$ 对 $H_a: p\ne 0.30$,得 p 值 $0.12$,$\alpha=0.05$。哪个结论最好?

B。因为 $0.12>0.05$,不拒绝 $H_0$,意思是证据不够有说服力,而不是 $H_0$ 得到证明(A)。p 值是在 $H_0$ 为真的假设下算出的,所以不是 $H_0$ 为真的概率(C)。D 需要 p 值不超过 $0.05$。

12. A $95\%$ $t$ interval for $\mu$ is $(24.1,\,27.3)$. For $H_0:\mu=28$ against $H_a:\mu\ne 28$ at $\alpha=0.05$, the matching one-sample $t$ test

A. A two-sided $t$ test at level $\alpha$ rejects $H_0:\mu=\mu_0$ exactly when $\mu_0$ is outside the $100(1-\alpha)\%$ interval. Being close does not matter, and the interval already summarizes the data needed.

12. $\mu$ 的 $95\%$ $t$ 区间为 $(24.1,\,27.3)$。对 $H_0:\mu=28$ 对 $H_a:\mu\ne 28$,在 $\alpha=0.05$ 下,对应的单样本 $t$ 检验

A。显著性水平为 $\alpha$ 的双侧 $t$ 检验,当且仅当 $\mu_0$ 落在 $100(1-\alpha)\%$ 区间之外时拒绝 $H_0:\mu=\mu_0$。接近区间并无影响,区间已经概括了所需的数据。